package com.ruowei.modules.sys.domain.enumeration;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.ruowei.config.enumConfig.BaseEnum;
import com.ruowei.modules.foodOrder.domain.enumeration.FlowType;

/**
 * The UserType enumeration.
 */
public enum UserType implements BaseEnum {
    EMPLOYEE("1", "员工"),
    MEMBER("2", "用户"),
    COURIER("3", "配送员"),
    BUSINESS("4", "商家"),
    STATION("5", "调度站"),
    ADMIN("6", "管理员");

    private final String code;
    private final String message;

    UserType(String code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    @JsonValue
    public String getMessage() {
        return message;
    }

    @JsonCreator
    public static UserType deserializer(String value) {
        for (UserType item : values()) {
            if (value.equals(item.getCode())
                || value.equals(item.getMessage())) {
                return item;
            }
        }
        return null;
    }
}
